package com.learn.project2.controller.admin;

import com.learn.project2.bean.MarketAftersale;
import com.learn.project2.model.bo.admin.aftersale.AftersaleListBO;
import com.learn.project2.model.vo.admin.aftersale.AftersaleListVO;
import com.learn.project2.service.admin.aftersale.AftersaleService;
import com.learn.project2.utils.Result;
import com.learn.project2.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.yaml.snakeyaml.error.Mark;

import java.util.List;

/**
 * \* Author: Valley
 * \* Date: 2022/1/6
 * \* Time: 22:45
 * \* Description:
 */
@RestController
@RequestMapping("admin/aftersale")
public class AfterSaleController {
    
    @Autowired
    AftersaleService aftersaleService;

    /** 
     * @description: 售后管理-列表
     * @param: [listBO] 
     * @return: com.learn.project2.utils.Result 
     * @author 王力
     * @date: 2022-01-07 17:51:19
     */ 
    @RequestMapping("list")
    public Result list(AftersaleListBO listBO){
        AftersaleListVO aftersaleListVO = aftersaleService.aftersaleList(listBO);
        return Result.ok(aftersaleListVO);
    }


    /**
     * @description: 售后管理-批量通过
     * @param: [ids]
     * @return: com.learn.project2.utils.Result
     * @author 王力
     * @date: 2022-01-07 18:43:01
     */
    @RequestMapping("batch-recept")
    public Result batchRecept(@RequestBody String ids){
        Integer code = aftersaleService.batchRecept(StringUtils.stringToInt(ids));
        return Result.ok();
    }

    /**
     * @description: 售后管理-批量拒绝
     * @param: [ids]
     * @return: com.learn.project2.utils.Result
     * @author 王力
     * @date: 2022-01-07 18:44:08
     */
    @RequestMapping("batch-reject")
    public Result batchReject(@RequestBody String ids){
        Integer code = aftersaleService.batchReject(StringUtils.stringToInt(ids));
        return Result.ok();
    }

    /**
     * @description: 售后-退款
     * @param: [aftersale]
     * @return: com.learn.project2.utils.Result
     * @author 王力
     * @date: 2022-01-12 16:44:40
     */
    @RequestMapping("refund")
    public Result refund(@RequestBody MarketAftersale aftersale){
        Integer code = aftersaleService.aftersaleRefund(aftersale);
        return Result.ok();
    }

    /**
     * @description: 审核通过
     * @param: [aftersale]
     * @return: com.learn.project2.utils.Result
     * @author 王力
     * @date: 2022-01-12 16:47:19
     */
    @RequestMapping("recept")
    public Result recept(@RequestBody MarketAftersale aftersale){
        Integer code = aftersaleService.aftersaleRecept(aftersale);
        return Result.ok();
    }

    /**
     * @description: 审核拒绝
     * @param: [aftersale]
     * @return: com.learn.project2.utils.Result
     * @author 王力
     * @date: 2022-01-12 16:47:59
     */
    @RequestMapping("reject")
    public Result reject(@RequestBody MarketAftersale aftersale){
        Integer code = aftersaleService.aftersaleReject(aftersale);
        return Result.ok();
    }



}
